// pages/edit/edit.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    randomNickname:'',
    color:'white',
    editLength:'0'
  },
  clickToReturnIndex:function(){
    wx.navigateBack({
      delta:1
    })
  },
  clickToEditRandomNickName:function(){
    var firstName = ['赵','钱','孙','李','周','吴','郑','王']
    var lastName = ['大锤','大熊','大猫','大马哈鱼','二狗','咸鱼']
    var _firstmax = firstName.length - 1
    var _lastmax = lastName.length - 1
    var _min = 0
    var firstNum = Math.floor(Math.random() * (_firstmax - _min + 1) + _min)
    console.log(firstNum)
    var lastNum = Math.floor(Math.random() * (_lastmax - _min + 1) + _min)
    console.log(lastNum)
    var _randomNickname = firstName[firstNum] + lastName[lastNum]
    this.setData({
      randomNickname : _randomNickname
    })
  },
  chooseColor:function(e){
    var _color = e.target.dataset.color
    this.setData({
      color:_color
    })
  },
  editInput:function(e){
    var _length = e.detail.value.length
    this.setData({
      editLength: _length
    })
  },
  clickToIndex: function () {
    wx.navigateBack({
      delta: 1
    })
  }
})